package org.truxingame.input;

public class Buttons {
	public static final int A = 0x1000;
	public static final int B = 0x2000;
	public static final int X= 0x4000;
	public static final int Y= 0x8000;

	public static final int Start= 0x0010;
	public static final int Back = 0x0020;
	public static final int LeftStick= 0x0040;
	public static final int RightStick= 0x0080;
	public static final int LeftShoulder= 0x0100;
	public static final int RightShoulder= 0x0200;


	public static final int DPadUp = 0x0001;
	public static final int DPadDown = 0x0002;
	public static final int DPadLeft = 0x0004;
	public static final int DPadRight = 0x0008;


	public static final int LeftStickDown= 0x10000;
	public static final int LeftStickLeft= 0x20000;
	public static final int LeftStickRight= 0x40000;
	public static final int LeftStickUp= 0x100000;
	public static final int LeftTrigger      = 0x200000;

	public static final int RightStickUp	 = 0x400000;
	public static final int RightStickRight  = 0x800000;
	public static final int RightStickLeft   = 0x1000000;
	public static final int RightStickDown   = 0x2000000;
	public static final int RightTrigger     = 0x4000000;

	protected int flags = 0;

	public Buttons(int _flags) {flags = _flags;}
	public void or(int flag) {flags |= flag;}
	public boolean has(int flag) {return (flags&flag)==flag;}

	public ButtonState getPressed(int flag) 
	{return (flags&flag)==flag?ButtonState.Pressed:ButtonState.Released;}
}	
